package org.android.bbox.utils;

import android.app.Activity;
import android.widget.CheckBox;
import android.widget.TextView;

public class RId
{
	public static String getTextViewValue(Activity a, int R)
	{
		return ((TextView) a.findViewById(R)).getText().toString().trim();
	}

	public static boolean getCheckBoxValue(Activity a, int R)
	{
		return ((CheckBox) a.findViewById(R)).isChecked();
	}

	public static void setBackroundColor(Activity a, int R, int color)
	{
		a.findViewById(R).setBackgroundColor(color);
		a.findViewById(R).invalidate();
	}

	public static boolean switchBackgroundColor(Activity a, int R, boolean valid)
	{
		//Alpha-Red-Green-Blue
		setBackroundColor(a, R, (valid)?0x0000FF00:0x00FF0000);
		return valid;
	}
}
